import apis from './'
import request from '@/utils/request'

export function getArticleClass (parameter) {
  return request({
    url: apis.ArticleClass,
    method: 'get',
    params: parameter
  })
}

export function getArticleClassDel (id) {
  return request({
    url: `${apis.ArticleClassDel}?id=${id}`,
    method: 'get'
  })
}

export function getArticleClassAdd () {
  return request({
    url: apis.ArticleClassAdd,
    method: 'get'
  })
}

export function postArticleClassAdd (data) {
  return request({
    url: `${apis.ArticleClassAdd}?pid=${data.pid}`,
    method: 'post',
    data: data
  })
}

export function getArticleClassEdit (id) {
  return request({
    url: `${apis.ArticleClassEdit}?id=${id}`,
    method: 'get'
  })
}

export function postArticleClassEdit (id, data) {
  return request({
    url: `${apis.ArticleClassEdit}?id=${id}`,
    method: 'post',
    data: data
  })
}

export function getArticleList (parameter) {
  return request({
    url: apis.ArticleList,
    method: 'get',
    params: parameter
  })
}

export function getArticleListDel (id) {
  return request({
    url: `${apis.ArticleListDel}?ids=${id}`,
    method: 'get'
  })
}

export function getArticleListAdd () {
  return request({
    url: apis.ArticleListAdd,
    method: 'get'
  })
}

export function postArticleListAdd (data) {
  return request({
    url: apis.ArticleListAdd,
    method: 'post',
    data: data
  })
}

export function getArticleListEdit (id) {
  return request({
    url: `${apis.ArticleListEdit}?id=${id}`,
    method: 'get'
  })
}

export function postArticleListEdit (id, data) {
  return request({
    url: `${apis.ArticleListEdit}?id=${id}`,
    method: 'post',
    data: data
  })
}

export function getImportArticle () {
  return request({
    url: apis.ImportArticle,
    method: 'get'
  })
}

export function postImportArticle (data) {
  return request({
    url: apis.ImportArticle,
    method: 'post',
    data: data
  })
}

export function getArticleCat (parameter) {
  return request({
    url: apis.ArticleCat,
    method: 'get',
    params: parameter
  })
}

export function getArticleCats (id) {
  return request({
    url: `${apis.ArticleCat}?pid=${id}`,
    method: 'get'
  })
}
